<template>
	<view>
		<staff-detail 
			:update="update" 
			:staffId="staffId" 
			@submit="handleSubmit" 
		></staff-detail>
	</view>
</template>

<script>
	import staffDetail from './components/detail.vue'
	
	export default {
		components: { staffDetail },
		data() {
			return {
				staffId: null,
				update: true
			}
		},
		onLoad(options) {
			this.staffId = options.staffId
			this.update = !!options.staffId
			
			// 注册一个通信接口
			this.eventChannel = this.getOpenerEventChannel()
			this.$wxSdkUtil.init(null, { hideShare: true })
		},
		methods: {
			// 监听提交事件 与上一个页面通信
			handleSubmit(postForm) {
				this.eventChannel.emit('submit', { postForm, msg: '修改了！！！' })
			},
		}
	}
</script>